package com.calsoft.Hops_Mobile_Tablet.base;
/*
 * User: Minh Diep
 * Date: 6/27/13
 * Time: 3:29 PM
 */

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.calsoft.Hops_Mobile_Tablet.R;

public class NavDrawerMenuArrayAdapter extends ArrayAdapter<String> {

    private final Context context;
    private final String[] values;

    public NavDrawerMenuArrayAdapter(Context context, String[] values) {
        super(context, R.layout.drawer_list_item, values);
        this.context = context;
        this.values = values;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View rowView = inflater.inflate(R.layout.drawer_list_item, parent, false);
        TextView titleTextView = (TextView) rowView.findViewById(R.id.nav_drawer_menu_title);
        ImageView iconImageView = (ImageView) rowView.findViewById(R.id.nav_drawer_menu_icon);
        titleTextView.setText(values[position]);
        iconImageView.setImageResource(App.APP_MENU_ICONS[position]);
        return rowView;
    }
}
